home *** CD-ROM | disk | FTP | other *** search
- #import "Aquarium.h"
- #import "Fish.h"
- #ifndef NS3x
- #import "Thinker.h"
- #else
- #import "Thinker3.h"
- #endif
- #import <libc.h>
- #import <objc/List.h>
- #import <dpsclient/wraps.h>
-
- #define NUM_OF_FISH 8
-
- @implementation AquariumView
-
- - oneStep
- {
- [fishList makeObjectsPerform:@selector(move:) with:fishList];
- return self;
- }
-
- - initFrame:(NXRect *)frameRect
- {
- int x;
-
- [super initFrame:frameRect];
- fishList = [[List allocFromZone:[self zone]] init];
- for (x=0;x<NUM_OF_FISH;x++)
- [fishList addObject:[[Fish allocFromZone:[self zone]] init:self]];
-
- return self;
- }
-
- - drawSelf:(const NXRect *)rects :(int)rectCount
- {
- if (!rects || !rectCount) return self;
-
- PSsetgray(NX_BLACK);
- NXRectFill(rects);
-
- return self;
- }
-
- - newViewSize
- {
- [fishList makeObjectsPerform:@selector(viewDidResize)];
- return self;
- }
-
- - (const char *)windowTitle
- {
- return "Fish Are So Damn Relaxing";
- }
-
- - didLockFocus
- {
- return self;
- }
-
- - sizeTo:(NXCoord)width :(NXCoord)height
- {
- [super sizeTo:width :height];
- [self newViewSize];
- return self;
- }
-
- - (BOOL)useBufferedWindow
- {
- return NO;
- }
-
- #ifdef NS3x
- -inspector:sender
- {
- char buf[MAXPATHLEN];
-
- if (!sharedInspectorPanel) {
- sprintf(buf,"%s/AquariumView.nib",[sender moduleDirectory:"Aquarium"]);
- [NXApp loadNibFile:buf owner:self withNames:NO];
- }
- return sharedInspectorPanel;
- }
- #endif
-
- @end
-